const state = {
    asideMenus: null,
    headerTabs: []
}

const mutations = {
    setAsideMenus: (state, asideMenus) => {
        state.asideMenus = asideMenus
    },
    addHederTab: (state, headerTab) => {
        const exist = state.headerTabs.some(val => val.name == headerTab.name)
        if(!exist){
            state.headerTabs.push(headerTab)
        }
    },
    removeHeaderTab: (state, headerTab) => {
        const index = state.headerTabs.findIndex( val => val.name == headerTab.name)
        state.headerTabs.splice(index, 1)
    }
}

export default {
    namespaced: true,//solve module namespaced conflict
    state,
    mutations
}